package edu.itcs6112.za.web.form;

import java.math.BigDecimal;
import java.util.List;

public class CartContents {
	private List<CartItem> items;
	private float cartTotal;
	private int itemCount;
	
	public List<CartItem> getCartContentData(){
		return items;
	}
	
	public void setCartContentData(List<CartItem> contents){
		for(CartItem itm : contents){
			BigDecimal extPrice = itm.getPrice().multiply(new BigDecimal(itm.getQuantity()));
			cartTotal += extPrice.floatValue();
			itemCount += itm.getQuantity();
		}
	
		this.items = contents;
	}

	public float getCartTotal() {
		return cartTotal;
	}
	
	public int getItemCount(){
		return itemCount;
	}
}
